package com.sys.SysModel.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.sys.common.annotation.Log;
import com.sys.common.core.controller.BaseController;
import com.sys.common.core.domain.AjaxResult;
import com.sys.common.enums.BusinessType;
import com.sys.SysModel.domain.SysModelTanks;
import com.sys.SysModel.service.ISysModelTanksService;
import com.sys.common.utils.poi.ExcelUtil;
import com.sys.common.core.page.TableDataInfo;

/**
 * 养殖桶模板Controller
 * 
 * @author ruoyi
 * @date 2025-09-29
 */
@RestController
@RequestMapping("/SysModel/SysModelTanks")
public class SysModelTanksController extends BaseController
{
    @Autowired
    private ISysModelTanksService sysModelTanksService;

    /**
     * 查询养殖桶模板列表
     */
    @PreAuthorize("@ss.hasPermi('SysModel:SysModelTanks:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysModelTanks sysModelTanks)
    {
        startPage();
        List<SysModelTanks> list = sysModelTanksService.selectSysModelTanksList(sysModelTanks);
        return getDataTable(list);
    }

    /**
     * 导出养殖桶模板列表
     */
    @PreAuthorize("@ss.hasPermi('SysModel:SysModelTanks:export')")
    @Log(title = "养殖桶模板", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysModelTanks sysModelTanks)
    {
        List<SysModelTanks> list = sysModelTanksService.selectSysModelTanksList(sysModelTanks);
        ExcelUtil<SysModelTanks> util = new ExcelUtil<SysModelTanks>(SysModelTanks.class);
        util.exportExcel(response, list, "养殖桶模板数据");
    }

    /**
     * 获取养殖桶模板详细信息
     */
    @PreAuthorize("@ss.hasPermi('SysModel:SysModelTanks:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(sysModelTanksService.selectSysModelTanksById(id));
    }

    /**
     * 新增养殖桶模板
     */
    @PreAuthorize("@ss.hasPermi('SysModel:SysModelTanks:add')")
    @Log(title = "养殖桶模板", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysModelTanks sysModelTanks)
    {
        return toAjax(sysModelTanksService.insertSysModelTanks(sysModelTanks));
    }

    /**
     * 修改养殖桶模板
     */
    @PreAuthorize("@ss.hasPermi('SysModel:SysModelTanks:edit')")
    @Log(title = "养殖桶模板", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysModelTanks sysModelTanks)
    {
        return toAjax(sysModelTanksService.updateSysModelTanks(sysModelTanks));
    }

    /**
     * 删除养殖桶模板
     */
    @PreAuthorize("@ss.hasPermi('SysModel:SysModelTanks:remove')")
    @Log(title = "养殖桶模板", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysModelTanksService.deleteSysModelTanksByIds(ids));
    }
}
